package com.qf.config;

import com.qf.pojo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 用户配置类
 *
 *   spring-context.xml ==  @Configuration
 *
 *    *     <bean id="user"  class="com.qf.pojo.User"  init-method  destroy-method>
 *  *          <proprety name=id  value=123
 *  *         </bean>
 * @author lixu
 */
@Configuration //进行实例化
public class UserConfig {


    /**
     * 实例化用户对象 并给对象赋值
     *
     * @Bean        <bean
     * 1、方法名  id="user"
     * 2、方法的返回值类型   class="com.qf.pojo.User"
     */
    @Bean(name = "user",initMethod = "initM")
    public User user1234556(){
        User user = new User();
        user.setId(123);
        user.setName("小张");
        return user;
    }
}
